INCLUDE(${CMAKE_SOURCE_DIR}/COMMON.cmake)

############################# libdaodictv source Files ####################################

ADD_SRC_DIR(daodictv_srcs common)
ADD_SRC_DIR(daodictv_srcs common/component)
ADD_SRC_DIR(daodictv_srcs common/dictdb)

############################# daodict ####################################

ADD_SRC_DIR(daodict_srcs daodict)
ADD_SRC_DIR(daodict_srcs daodict/core)
ADD_SRC_DIR(daodict_srcs daodict/prefers)
ADD_SRC_DIR(daodict_srcs daodict/addons)
ADD_SRC_DIR(daodict_srcs daodict/notebooks)

############################# dao_bgl2txt source Files ####################################

ADD_SRC_DIR(bgl2txt_srcs bgl2txt)

############################# dao_txt2dict source Files ####################################

ADD_SRC_DIR(txt2dict_srcs txt2dict)

############################# dao_dictpack source Files ####################################

ADD_SRC_DIR(dictpack_srcs dictpack)

####################### FOR WIN32 ONLY ##########################
IF(WIN32) # FOR WIN32
    FIND_PROGRAM(WINDRES windres DOC "MinGW windres")
    ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/daodict.rc.o
        COMMAND ${WINDRES} -I $ENV{WXWIN}/include -i ${CMAKE_CURRENT_SOURCE_DIR}/daodict/daodict.rc -o ${CMAKE_CURRENT_BINARY_DIR}/daodict.rc.o
        DEPENDS ./daodict/daodict.rc
    )
    
    ADD_SRC_FILE(daodict_srcs ${CMAKE_CURRENT_BINARY_DIR}/daodict.rc.o)
ENDIF(WIN32)

######################## generate version info #####################################
IF (PYTHON_EXECUTABLE)
    ADD_CUSTOM_COMMAND(
        OUTPUT ./common/verinfo.h ./common/verinfo.iss
        COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/common/gen_verinfo.py
        DEPENDS ./common/gen_verinfo.py
    )
ENDIF (PYTHON_EXECUTABLE)
